package com.api.apigateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.cloud.gateway.route.RedisRouteDefinitionRepository;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication(exclude = {
        DataSourceAutoConfiguration.class,
        DataSourceTransactionManagerAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class,
},
        scanBasePackages = {"com.api.apigateway.config"}
)
@ComponentScan(basePackages = {"com.api.common", "com.api.apigateway"})
@EnableDubbo
public class ApiGatewayApplication {

    /**
     * 提供的接口要与提供端注册到注册中心的接口:com.cui.project.provider.DemoService
     * 包名要一致
     */
//    @DubboReference
//    private DemoService demoService;
    public static void main(String[] args) {
        System.setProperty("user.home", "86176");
        ConfigurableApplicationContext context =
                SpringApplication.run(ApiGatewayApplication.class, args);

//        final ApiGatewayApplication apiGatewayApplication = context.getBean(ApiGatewayApplication.class);

//        System.out.println("----------------- "+apiGatewayApplication.demoService.sayHello("1232"));
//        System.out.println("----------------- "+apiGatewayApplication.demoService.sayHello2("ccc"));
    }


}
